﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Office.Interop.Word;

namespace WFL.Office.Word
{
    public class WordShapes
    {
        public WordShape this[int index]
        {
            get { return new WordShape(_shapes[index]); }
        }

        public WordShape this[string index]
        {
            get { return new WordShape(_shapes[index]); }
        }

        private Shapes _shapes;

        internal WordShapes(Shapes shapes)
        {
            _shapes = shapes;
        }

        public WordShape AddPicture(string fileName, bool linkToFile = false, bool saveWithDocument = false, int? left = null, int? top = null, int? width = null, int? height = null, WordRange anchor = null)
        {
            object leftArg = left ?? Type.Missing;
            object topArg = top ?? Type.Missing;
            object widthArg = width ?? Type.Missing;
            object heightArg = height ?? Type.Missing;
            object anchorArg = anchor != null ? anchor._range : Type.Missing;
            return new WordShape(_shapes.AddPicture(fileName, linkToFile, saveWithDocument, leftArg, topArg, widthArg, heightArg, anchorArg));
        }
    }
}
